package com.singzi.leetcode.N1600;

public class T1518 {
    public static void main(String[] args) {
        Solution1518 solution1518 = new Solution1518();
        System.out.println(solution1518.numWaterBottles(2, 3));
    }
}
class Solution1518 {
    public int numWaterBottles(int numBottles, int numExchange) {

        int sum = numBottles;
        while(numBottles >= numExchange){
            sum+=numBottles/numExchange;
            numBottles = numBottles%numExchange + numBottles/numExchange;
        }
        return sum;

    }
}